#include <iostream>
#include <vector>

using namespace std;
int n, m;
vector<int> now;

void print()
{
    for(auto e: now)
        cout << e << ' ';
    cout << endl;
}

void dfs(int x, int times)
{
    if(times == m)
    {
        print();
        return;
    }
    for(int i = x; i <= n; ++i)
    {
        now.push_back(i);
        dfs(i + 1, times + 1);
        now.pop_back();
    }
}

int main()
{
    cin >> n >> m;
    dfs(1, 0);
    return 0;
}